package org.example.domain.order.service.mq_v1;


import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.common.message.MessageExt;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

import java.nio.charset.StandardCharsets;

import static org.example.types.common.MQConstants.LOCK_ORDER_CONSUMER_GROUP;

/**
 * @author yinghuashen
 * @version 1.0
 * @description:
 * @date 2025/3/10 14:05
 */
@Slf4j
@Component
@RocketMQMessageListener(
        consumerGroup = ("DLQ_"+LOCK_ORDER_CONSUMER_GROUP),
        topic = ("%DLQ%"+LOCK_ORDER_CONSUMER_GROUP)
)
public class LockOrderDeadLetterHandler implements RocketMQListener<MessageExt> {
    @Override
    public void onMessage(MessageExt message) {
        log.warn("死信队列消费消息: {}", new String(message.getBody(), StandardCharsets.UTF_8));
    }
}
